package com.android.king.vo;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;

public class MyFileItem implements Serializable, Parcelable {
    public String name;       //文件的名字
    public String path;       //文件的路径
    public long size;         //文件的大小
    public String mimeType;   //文件的类型
    public long addTime;      //文件的创建时间
    public String objetype;   //表明文件本身是图片还文件



    /** 文件的路径和创建时间相同就认为是同一文件 */
    @Override
    public boolean equals(Object o) {
        if (o instanceof MyFileItem) {
            MyFileItem item = (MyFileItem) o;
            return this.path.equalsIgnoreCase(item.path) && this.addTime == item.addTime;
        }

        return super.equals(o);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.name);
        dest.writeString(this.path);
        dest.writeLong(this.size);
        dest.writeString(this.mimeType);
        dest.writeLong(this.addTime);
        dest.writeString(this.objetype);
    }

    public MyFileItem() {
    }

    protected MyFileItem(Parcel in) {
        this.name = in.readString();
        this.path = in.readString();
        this.size = in.readLong();
        this.mimeType = in.readString();
        this.addTime = in.readLong();
        this.objetype=in.readString();
    }

    public static final Parcelable.Creator<MyFileItem> CREATOR = new Parcelable.Creator<MyFileItem>() {
        @Override
        public MyFileItem createFromParcel(Parcel source) {
            return new MyFileItem(source);
        }

        @Override
        public MyFileItem[] newArray(int size) {
            return new MyFileItem[size];
        }
    };

}
